package com.wetsion.securityoauthdemo.server.web;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by wetsion on 2019/3/2.
 */
@RestController
public class ProductController {

    @GetMapping("/product/{id}")
    public String product(@PathVariable Long id) {
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        return "product" + id;
    }
}
